package com.xuz.adapter.example02;

import com.xuz.adapter.example01.SDCard;
import com.xuz.adapter.example01.TFCard;

/**
 * 对象适配器-组合形式
 *
 * @user 65453
 * @date 2024/10/15 21:36
 */
public class SDAdapterTF implements SDCard {
    private TFCard tfCard;

    public SDAdapterTF(TFCard tfCard) {
        this.tfCard = tfCard;
    }

    @Override
    public String readSD() {
        System.out.println("adapter read tf card");
        return tfCard.readTF();
    }

    @Override
    public void writeSD(String msg) {
        System.out.println("adapter write tf card");
        tfCard.writeTF(msg);
    }
}
